package com.meeting.meeting.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.meeting.meeting.dao.RoomMapper;
import com.meeting.meeting.model.Department;
import com.meeting.meeting.model.Room;
import com.meeting.meeting.service.RoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 何星霖
 * @date 2019/1/31 17:55
 */
@Service
public class RoomServiceImpl  implements RoomService {
    @Autowired
    RoomMapper roomMapper;
    @Override
    public int deleteByPrimaryKey(Integer id) {
        return roomMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Room record) {
        return roomMapper.insert(record);
    }

    @Override
    public Room selectByPrimaryKey(Integer id) {
        return roomMapper.selectByPrimaryKey(id);
    }

    @Override
    public PageInfo<Room>  selectAll(int pageNum, int pageSize, Room room) {
        PageHelper.startPage(pageNum,pageSize);
        List<Room> list=roomMapper.selectAll(room);
        PageInfo<Room> pageInfo = new PageInfo<Room>(list);
        return pageInfo;
    }

    @Override
    public int updateByPrimaryKey(Room record) {
        return roomMapper.updateByPrimaryKey(record);
    }
}
